/*
 *    Copyright (c) 2018-2025, jeebootx All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the lianzhu developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: jeebootx
 */

import request from '@/utils/services/axios'

// no top menu 20210107
export function getUserTopMenu() {
    return request({
        url: '/api/admin/user-menu/tree',
        method: 'get',
        params: { type: '2', terminalType: '1' }
    })
}

// 用户权限范围内 菜单树(type = 1) 或 菜单树+权限(type = null)，
export function getUserMenuTree(parentId) {
    return request({
        url: '/api/admin/user-menu/tree',
        method: 'get',
        params: { terminalType: '1', parentId: parentId }
    })
}
// 用户权限范围内的菜单+权限集合，为角色分配权限
export function getUserPermMenuTree() {
    return request({
        url: '/api/admin/user-menu/permTree',
        method: 'get'
    })
}
//  返回角色的菜单+权限集合
export function getRoleMenuPermIds(roleId) {
    return request({
        url: '/api/admin/user-menu/role/' + roleId,
        method: 'get'
    })
}

//  返回群组的菜单+权限集合
export function getGroupMenuPermIds(groupId) {
    return request({
        url: '/api/admin/user-menu/group/' + groupId,
        method: 'get'
    })
}
